﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace ShootEm.Components
{
    class PlayNow : Microsoft.Xna.Framework.DrawableGameComponent
    {
        Texture2D texture;
        public PlayNow(ShootEm game)
            : base(game)
        {
        }

        public override void Initialize()
        {
            // TODO: Add your initialization code here

            this.texture = this.Game.Content.Load<Texture2D>("Textures/playnow");
            base.Initialize();
        }

        public override void Update(GameTime gameTime)
        {
            MouseState mouseState = Mouse.GetState();
            if (mouseState.LeftButton == ButtonState.Pressed)
            {
                if (mouseState.X > 400 && mouseState.X < 600 && mouseState.Y > 219 && mouseState.Y < 382)
                {
                    ((ShootEm)this.Game).play = true;
                    this.Game.Components.Remove(this);
                }
            }
            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            ((ShootEm)this.Game).spriteBatch.Begin();
            ((ShootEm)this.Game).spriteBatch.Draw(this.texture, new Vector2(400, 219), Color.White);
            ((ShootEm)this.Game).spriteBatch.End();
            base.Draw(gameTime);
        }
    }
}
